

<script type="text/javascript" charset="utf-8" src="<?php echo Yii::app()->baseUrl?>/layer/layer.js"></script>

 <script>
	var platform = navigator.userAgent.toLowerCase();
	window.isIosDevice = (/iphone|ipod|ipad/gi).test(platform);
	window.isIPad = (/ipad/gi).test(platform);
	window.isAndroid = (/android/gi).test(platform);
	window.isAndroidOld = (/android 2.3/gi).test(platform) || (/android 2.2/gi).test(platform);
	window.isSafari = (/safari/gi).test(platform) && !(/chrome/gi).test(platform);
	function object2str(arr, deep)
	{
		if ( typeof arr === "number" || ( !isNaN(+arr) && arr !== '' ) ) return arr;
		else if ( typeof arr === "string" ) return '"' + arr + '"';
		else if ( typeof arr === "function" ) return "一个函数";
		else if ( typeof arr !== "object" ) return String(arr);
		else if ( Object.prototype.toString.call(arr) == "[object RegExp]" ) return arr.toSource();
		var s, i, k, indent, symbol = '    ';
		deep = deep || 1;
		for (indent = '', i = 0; i < deep; i++) indent += symbol;
		s = "Array(\n";
		for (k in arr) {
			s += indent + object2str(k) + ' => ' + object2str(arr[k], deep + 1) + ',\n';
		}
		s += indent.replace(symbol, '') + ')';
		return s;
	}
	function print_r(arr, ret)
	{
		var source = object2str(arr);
		return ret ? source : alert( source );
	}

	/*接收设备信息，callSystemInfo执行后自动执行此方法*/

	function getSystemInfo(json)
        {
                print_r(json);
        }

	/*获取设备信息*/

	function callSystemInfo()
	{
		if (isIosDevice)
		{
			document.location.hash = '#func=getSystemInfo&parameter={"action" : "haha"}' + '&' + Math.random();
		}
		else if(isAndroid)
		{
			window.android.callSystemInfo();
		}
	}

	/*接收用户登录信息，callUserInfo执行后自动执行此方法*/

        function getUserInfo(data)
        {
            if(data['userInfo'] != undefined ){
                document.getElementById('Users_app_userid').value=data['userInfo']['userid'];
                document.getElementById('Users_app_name').value=data['userInfo']['username'];

            }else{
                    alert('报名需通过"智慧烟台"app,登入成功后即可参加报名！');
            }
        }



	/*获取用户登录信息*/

	function callUserInfo()
	{
		if (isIosDevice)
		{
			//alert(document.location.hash);
			document.location.hash = '#func=getUserInfo&parameter={"action" : "haha"}' + '&' + Math.random();
		}
		else if(isAndroid)
		{
			window.android.callUserInfo();
		}
	}


	/*进入用户中心*/

	function goUcenter()
	{
		if (isIosDevice)
		{
			document.location.hash = '#func=goUcenter' + '&' + Math.random();;
		}
		else if(isAndroid)
		{
			window.android.goUcenter();
		}
	}

	/*进入用户中心登录后回调函数*/

	function userLoginSuccess(json)
	{
           print_r(json);
	}

	/*内链跳转*/

	function goOutLink(tag)
	{
		if (isIosDevice)
		{
			document.location.hash = '#func=goOutlink&parameter='+tag+'';
		}
		else if(isAndroid)
		{
			window.android.goOutlink(tag);
		}
	}
        
	
  </script>


<link rel="stylesheet" href="http://kindeditor.net/ke4/themes/default/default.css" type="text/css" />
<!--表单内容-->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'users-form',
	'enableAjaxValidation'=>false,
        'enableClientValidation'=>true,
        'clientOptions'=>array(
            'validateOnSubmit'=>true
        ),
       'htmlOptions'=>array('enctype'=>'multipart/form-data','class'=>'am-form'),
)); ?>
<style>
    .errorMessage{
        color:red;
    }
    

</style>

<img style="width: 100%; height: 30%" src="<?php echo Yii::app()->baseUrl?>/images/粉色萌宝方案.jpg" /> 
<fieldset style="width:100% !important;">
     <div class="am-form-group ">
      <label class="am-form-label" for="doc-ipt-warning">姓名</label>
      <?php echo $form->textField($model,'username',array('class'=>'am-form-field','placeholder'=>'输入姓名')); ?>
         <?php echo $form->error($model,'username'); ?>
     </div>
    
    <div class="am-form-group ">
      <label class="am-form-label" for="doc-ipt-warning">手机</label>
      <?php echo $form->textField($model,'phone',array('class'=>'am-form-field','placeholder'=>'输入手机号码')); ?>
        <?php echo $form->error($model,'phone'); ?>
     </div>
    
     

    <div class="am-form-group">
        <label class="am-form-label" for="doc-ipt-warning">图片上传</label>
        <?php echo CHtml::activeFileField($model,'head_image',array('style'=>'width:90%')); ?>
        <p class="am-form-help">提示：图片不能超过500kb</p>
        <?php echo $form->error($model,'head_image'); ?>
    </div>
      

    <div class="am-form-group ">
       <label class="am-form-label" for="doc-ipt-warning">自我介绍</label>
        <?php echo $form->textArea($model,'remark',array('rows'=>5, 'cols'=>50,'class'=>'am-form-field','placeholder'=>'输入自我介绍，个人详情，拉票宣言等信息')); ?>
         <?php echo $form->error($model,'remark'); ?>
    </div>
          
          
      <div class="am-form-group " style="text-align:center;">
          <?php echo $form->hiddenField($model,'vote_id',array('value'=>1));?>
          <?php echo $form->hiddenField($model,'app_userid');?> 
          <?php echo $form->hiddenField($model,'app_name');?> 
          <?php echo $form->error($model,'app_userid'); ?>
      </div>
      
    <div class="am-center">
        <button type="submit" class="am-btn am-btn-danger am-radius am-center">立即报名</button>
    </div>

    
  </fieldset>
    
<script>
if (isIosDevice)
{
        //alert(document.location.hash);
        document.location.hash = '#func=getUserInfo&parameter={"action" : "haha"}' + '&' + Math.random();
}
else if(isAndroid)
{
        window.android.callUserInfo();
}

</script>
  <?php if(Yii::app()->user->getFlash('success')){
        echo "<script>layer.alert('报名成功，请等待审核！', {icon: 6});</script>";
        }
        if(Yii::app()->user->getFlash('imgage_error')){
           echo "<script>layer.alert('图片应小于500kb。', {icon: 2});</script>"; 
        }
        if(Yii::app()->user->getFlash('imgage_type_error')){
           echo "<script>layer.alert('图片格式必须为jpg, jpeg,\<br/> gif, png 其中之一。', {icon: 2});</script>"; 
        }        
    ?>

 <?php $this->endWidget(); ?>          

